SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[ArchiveReportSelect]
    @Id INT
AS 
    BEGIN
        SELECT  ArchiveReport.Id ,
                ArchiveReport.UserId ,
                UserInfo.Login ,
                ArchiveReport.TemplateId ,
                WordTemplate.FileName ,
                ArchiveReport.Name ,
                ArchiveReport.DateCreated ,
                ArchiveReport.Deleted
        FROM    ArchiveReport
                LEFT JOIN UserInfo ON ( ArchiveReport.UserId = UserInfo.Id )
                LEFT JOIN WordTemplate ON ( ArchiveReport.TemplateId = WordTemplate.Id )
        WHERE   ArchiveReport.Id = @Id
    END
GO
